//public是对axios的工具类封装，定义了http请求方法
import http from './../../../base/api/public'
import querystring from 'querystring'
let sysConfig=require('@/../config/sysConfig')
let apiUrl=sysConfig.xcApiUrlPre


//获取所有站点信息
export const site_list = () =>{
  return http.requestGet(apiUrl + "/cms/site/list")
}

//获取所有模板信息
export const template_list = () =>{
  return http.requestGet(apiUrl + "/cms/template/list")
}

//分页查询
export const page_list = (page,size,params) => {
//将json对象转成key/value对
let queryString = querystring.stringify(params)
//请求服务端的页面查询接口
return http.requestQuickGet(apiUrl+'/cms/page/list/'+page+'/'+size+'/?'+queryString)
}

//新增页面
export const page_add = params => {
  return http.requestPost(apiUrl+'/cms/page/add',params)
}

///查询单个页面信息
export const page_get = id => {
  return http.requestQuickGet(apiUrl+'/cms/page/get/'+id)
}

/*页面修改，采用put方法*/
export const page_edit=(id,params) => {
  return http.requestPut(apiUrl+'/cms/page/edit/'+id,params)
}

//页面删除
export const page_del= id => {
  return http.requestDelete(apiUrl+'/cms/page/del/'+id)
}

//发布页面
export const page_postPage= id => {
  return http.requestPost(apiUrl+'/cms/page/postPage/'+id)
}
